package edu.bu.cs673.superkids123.children.view.games;

import javax.swing.JLabel;
import java.awt.Color;
import javax.swing.Icon;

import edu.bu.cs673.superkids123.children.model.resources.ChildrenResource;
import edu.bu.cs673.superkids123.children.model.resources.ChildrenResourceProvider;

/**
 * A class that extends ImageIcon which will construct the targets in the Archery Game.
 * 
 * @author Noah Fredriks
 */
public class ArcheryGameTarget extends JLabel {

	/**
	 * The default UID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * The ImageIcon of used to display the picture in the label;
	 */
	private static Icon icon;

	/**
	 * A flag used to signify the correct target to be hit
	 */
	private boolean correctAnswer;

	/**
	 * Creates a ArcheryGameTarget ImageIcon from a prespecified image filename
	 */
	public ArcheryGameTarget() {
		super();

		ChildrenResourceProvider provider = ChildrenResourceProvider.getInstance();
		icon = provider.getImage(ChildrenResource.imageTarget);
		setIcon(icon);

		setVerticalAlignment(JLabel.TOP);
		setHorizontalAlignment(JLabel.CENTER);
		setForeground(Color.black);
		correctAnswer = false;

	}

	/**
	 * Creates a ArcheryGameTarget ImageIcon from a prespecified image filename
	 * 
	 */
	public ArcheryGameTarget(boolean isCorrect) {
		super(icon);
		correctAnswer = isCorrect;
		setVerticalAlignment(JLabel.TOP);
		setHorizontalAlignment(JLabel.CENTER);

	}

	public boolean isCorrect() {
		return correctAnswer;
	}

	public void setCorrect(boolean isCorrect) {
		correctAnswer = isCorrect;
	}

}